
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ProspectiveGuest.java
 *
 * Created on Dec 13, 2011, 1:58:32 AM
 */

/**
 *
 * @author dabeast23
 */
public class CurrentGuest extends javax.swing.JFrame {

    /** Creates new form ProspectiveGuest */
    public CurrentGuest() {
        setResizable(false);
	setTitle("Hotel Kiosk: Current Guest");
	setDefaultCloseOperation(this.EXIT_ON_CLOSE);
        initComponents();
        this.setLocationRelativeTo(null);
    }
    
    public CurrentGuest(ArrayList<Reservation> reservationList, Reservation currentGuest) {
        this.reservationList = reservationList;
        this.currentGuest = currentGuest;
        setResizable(false);
	setTitle("Hotel Kiosk: Current Guest");
	setDefaultCloseOperation(this.EXIT_ON_CLOSE);
        initComponents();
        
                
        this.setLocationRelativeTo(null);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        backgroundPanel = new javax.swing.JPanel();
        roomServiceButton = new javax.swing.JButton();
        wakeUpCallButton = new javax.swing.JButton();
        checkOutButton = new javax.swing.JButton();
        separator = new javax.swing.JSeparator();
        totalBillAmountLabel = new javax.swing.JLabel();
        backButton = new javax.swing.JButton();
        requestRoomCleanButton = new javax.swing.JButton();
        currentGuestLabel1 = new javax.swing.JLabel();
        guestLabel = new javax.swing.JLabel();
        guestNameLabel = new javax.swing.JLabel();
        roomLabel = new javax.swing.JLabel();
        roomNumLabel = new javax.swing.JLabel();
        totalBillLabel = new javax.swing.JLabel();
        wakeUpLable = new javax.swing.JLabel();
        wakeUpTimeLabel = new javax.swing.JLabel();
        wakeUpLable1 = new javax.swing.JLabel();
        cleaningStatusLabel = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        backgroundPanel.setBackground(new java.awt.Color(102, 0, 0));
        backgroundPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        roomServiceButton.setBackground(new java.awt.Color(255, 255, 204));
        roomServiceButton.setFont(new java.awt.Font("Comic Sans MS", 0, 18));
        roomServiceButton.setForeground(new java.awt.Color(102, 0, 0));
        roomServiceButton.setText("Room Service");
        roomServiceButton.setBorder(null);
        roomServiceButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                roomServiceButtonActionPerformed(evt);
            }
        });
        backgroundPanel.add(roomServiceButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(89, 68, 216, 34));

        wakeUpCallButton.setBackground(new java.awt.Color(255, 255, 204));
        wakeUpCallButton.setFont(new java.awt.Font("Comic Sans MS", 0, 18));
        wakeUpCallButton.setForeground(new java.awt.Color(102, 0, 0));
        wakeUpCallButton.setText("Request Wake Up Call");
        wakeUpCallButton.setBorder(null);
        wakeUpCallButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                wakeUpCallButtonActionPerformed(evt);
            }
        });
        backgroundPanel.add(wakeUpCallButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 170, 216, 31));
        if(currentGuest.isWakeUpCallSet()==true)
        {
            wakeUpCallButton.setText("Change/Cancel Wake Up");
        }

        checkOutButton.setBackground(new java.awt.Color(255, 255, 204));
        checkOutButton.setFont(new java.awt.Font("Comic Sans MS", 0, 18));
        checkOutButton.setForeground(new java.awt.Color(102, 0, 0));
        checkOutButton.setText("Check Out");
        checkOutButton.setBorder(null);
        checkOutButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkOutButtonActionPerformed(evt);
            }
        });
        backgroundPanel.add(checkOutButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 260, 171, 33));

        separator.setForeground(new java.awt.Color(255, 255, 204));
        backgroundPanel.add(separator, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 240, 111, 10));

        totalBillAmountLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        totalBillAmountLabel.setForeground(new java.awt.Color(255, 255, 204));
        totalBillAmountLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        totalBillAmountLabel.setText("Total Bill:");
        backgroundPanel.add(totalBillAmountLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(380, 120, -1, 39));
        String totalBillString = Double.toString((double)Math.round(currentGuest.getTotalBill() * 100) / 100);
        totalBillAmountLabel.setText("$"+totalBillString);

        backButton.setBackground(new java.awt.Color(255, 255, 204));
        backButton.setFont(new java.awt.Font("Comic Sans MS", 0, 11));
        backButton.setForeground(new java.awt.Color(255, 255, 255));
        backButton.setText("Back");
        backButton.setContentAreaFilled(false);
        backButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                backButtonActionPerformed(evt);
            }
        });
        backgroundPanel.add(backButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(380, 270, -1, -1));

        requestRoomCleanButton.setBackground(new java.awt.Color(255, 255, 204));
        requestRoomCleanButton.setFont(new java.awt.Font("Comic Sans MS", 0, 18));
        requestRoomCleanButton.setForeground(new java.awt.Color(102, 0, 0));
        requestRoomCleanButton.setText("Request Room Clean");
        requestRoomCleanButton.setBorder(null);
        requestRoomCleanButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                requestRoomCleanButtonActionPerformed(evt);
            }
        });
        backgroundPanel.add(requestRoomCleanButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 120, 216, 31));

        currentGuestLabel1.setFont(new java.awt.Font("Tahoma", 1, 24));
        currentGuestLabel1.setForeground(new java.awt.Color(255, 255, 204));
        currentGuestLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        currentGuestLabel1.setText("Current Guest");
        backgroundPanel.add(currentGuestLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 10, -1, 39));

        guestLabel.setFont(new java.awt.Font("Tahoma", 1, 14));
        guestLabel.setForeground(new java.awt.Color(255, 255, 204));
        guestLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        guestLabel.setText("Guest:");
        backgroundPanel.add(guestLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 0, -1, 39));

        guestNameLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        guestNameLabel.setForeground(new java.awt.Color(255, 255, 204));
        guestNameLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        guestNameLabel.setText("Guest:");
        backgroundPanel.add(guestNameLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(380, 20, -1, 39));
        guestNameLabel.setText(currentGuest.getGuestName());

        roomLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        roomLabel.setForeground(new java.awt.Color(255, 255, 204));
        roomLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        roomLabel.setText("Room:");
        backgroundPanel.add(roomLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 50, -1, 39));

        roomNumLabel.setFont(new java.awt.Font("Tahoma", 1, 14));
        roomNumLabel.setForeground(new java.awt.Color(255, 255, 204));
        roomNumLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        roomNumLabel.setText("Room:");
        backgroundPanel.add(roomNumLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(380, 70, -1, 39));
        roomNumLabel.setText(currentGuest.getRoomNumber().toString());

        totalBillLabel.setFont(new java.awt.Font("Tahoma", 1, 14));
        totalBillLabel.setForeground(new java.awt.Color(255, 255, 204));
        totalBillLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        totalBillLabel.setText("Total Bill:");
        backgroundPanel.add(totalBillLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 100, -1, 39));

        wakeUpLable.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        wakeUpLable.setForeground(new java.awt.Color(255, 255, 204));
        wakeUpLable.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        wakeUpLable.setText("Room clean:");
        backgroundPanel.add(wakeUpLable, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 150, -1, 39));

        wakeUpTimeLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        wakeUpTimeLabel.setForeground(new java.awt.Color(255, 255, 204));
        wakeUpTimeLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        wakeUpTimeLabel.setText("none");
        backgroundPanel.add(wakeUpTimeLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(380, 220, -1, 39));
        if(currentGuest.isWakeUpCallSet()==true)
        {
            wakeUpTimeLabel.setText(currentGuest.getWakeUpHour()+":"+currentGuest.getWakeUpMinuteString()+currentGuest.getWakeUpAMPMString());
        }

        wakeUpLable1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        wakeUpLable1.setForeground(new java.awt.Color(255, 255, 204));
        wakeUpLable1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        wakeUpLable1.setText("Wake Up Call:");
        backgroundPanel.add(wakeUpLable1, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 200, -1, 39));

        cleaningStatusLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        cleaningStatusLabel.setForeground(new java.awt.Color(255, 255, 204));
        cleaningStatusLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        cleaningStatusLabel.setText("none");
        backgroundPanel.add(cleaningStatusLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(380, 170, -1, 39));
        if(currentGuest.isWakeUpCallSet()==true)
        {
            wakeUpTimeLabel.setText(currentGuest.getWakeUpHour()+":"+currentGuest.getWakeUpMinuteString()+currentGuest.getWakeUpAMPMString());
        }

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(backgroundPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 488, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(backgroundPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 307, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void roomServiceButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_roomServiceButtonActionPerformed
        RoomService RS = new RoomService(reservationList,currentGuest);
        RS.setVisible(true);
        this.setVisible(false);
    }//GEN-LAST:event_roomServiceButtonActionPerformed

    private void wakeUpCallButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_wakeUpCallButtonActionPerformed
        // TODO add your handling code here:
        WakeUpCall WUC = new WakeUpCall(reservationList,currentGuest);
        WUC.setVisible(true);
        this.setVisible(false);
    }//GEN-LAST:event_wakeUpCallButtonActionPerformed

    private void checkOutButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkOutButtonActionPerformed
        // TODO add your handling code here:
        CheckOutScreen COS = new CheckOutScreen(reservationList,currentGuest);
        COS.setVisible(true);
        this.setVisible(false);
    }//GEN-LAST:event_checkOutButtonActionPerformed

    private void backButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backButtonActionPerformed
        ChooseUserScreen CUS = new ChooseUserScreen(reservationList);
        CUS.setVisible(true);
        this.setVisible(false);
    }//GEN-LAST:event_backButtonActionPerformed

    private void requestRoomCleanButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_requestRoomCleanButtonActionPerformed
        // TODO add your handling code here:

        if(requestRoomCleanButton.getText().equals("Cancel Room Clean"))
        {
            int n = JOptionPane.showConfirmDialog(this,
            "Are you sure you would like to cancel your request for your room to be cleaned?",
            "Confirm Cancel Room Clean", JOptionPane.YES_NO_OPTION);
            if(n==0)
            {
                cleaningStatusLabel.setText("none");
                requestRoomCleanButton.setText("Request Room Clean");
            }

        }
        else
        {
           int n = JOptionPane.showConfirmDialog(this,
            "Are you sure you would like to request your room to be cleaned?",
            "Confirm Room Clean", JOptionPane.YES_NO_OPTION);
          
           
            if(n==0)
            {
                
                
              cleaningStatusLabel.setText("requested");
                requestRoomCleanButton.setText("Cancel Room Clean");
                
            }
        }
        
    }//GEN-LAST:event_requestRoomCleanButtonActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new CurrentGuest().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton backButton;
    private javax.swing.JPanel backgroundPanel;
    private javax.swing.JButton checkOutButton;
    private javax.swing.JLabel cleaningStatusLabel;
    private javax.swing.JLabel currentGuestLabel1;
    private javax.swing.JLabel guestLabel;
    private javax.swing.JLabel guestNameLabel;
    private javax.swing.JButton requestRoomCleanButton;
    private javax.swing.JLabel roomLabel;
    private javax.swing.JLabel roomNumLabel;
    private javax.swing.JButton roomServiceButton;
    private javax.swing.JSeparator separator;
    private javax.swing.JLabel totalBillAmountLabel;
    private javax.swing.JLabel totalBillLabel;
    private javax.swing.JButton wakeUpCallButton;
    private javax.swing.JLabel wakeUpLable;
    private javax.swing.JLabel wakeUpLable1;
    private javax.swing.JLabel wakeUpTimeLabel;
    // End of variables declaration//GEN-END:variables
    
    private ArrayList <Reservation> reservationList;
    Reservation currentGuest;
}
